package fr.sunnydale.android.geek;

import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import fr.sunnydale.android.geek.thread.TimerThread;
import fr.sunnydale.android.geek.util.GUtils;

/**
 * Main {@link Activity}.
 * @author doctor
 */
public class Dream extends Activity {

    public static TimerThread mTimerThread;
    public static Resources mResources;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mResources = getResources();
        mTimerThread = new TimerThread();
        mTimerThread.mRun = true;
        mTimerThread.start();
        GUtils.SCALE = getResources().getDisplayMetrics().density;
        GUtils.TILESIZE = 50 * GUtils.SCALE;
        setContentView(R.layout.main);
    }

    @Override
    protected void onDestroy() {
        mTimerThread.mRun = false;
        mTimerThread.stop();
        super.onDestroy();
    }
}